#include "pch.h"
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
	void moveZeroes(vector<int>& nums) {
		int len = nums.size();
		if (len < 2) return;

		int i = 0;
		int j = 0;
		while (j<len && i<len)
		{
			if (nums[j] == 0)
			{
				j++;
			}
			else
			{
				swap(nums[i++],nums[j++]);
			}
		}
	}
};

int main()
{
	vector<int> arr{ 0,1,0,3,12 };
	Solution s;
	s.moveZeroes(arr);
	for (int i = 0;i < arr.size();i++)
	{
		cout << arr[i] << " ";
	}
	return 0;
}